package com.kuangkuang.yimusic.ui.me

import android.annotation.SuppressLint
import android.os.Bundle
import android.util.Log
import android.view.*
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.kuangkuang.yimusic.R
import com.kuangkuang.yimusic.databinding.FragmentMeBinding

class UserCenterFragment : Fragment() {

    private lateinit var notificationsViewModel: UserCenterViewModel
    private var _binding: FragmentMeBinding? = null

    // This property is only valid between onCreateView and
    // onDestroyView.
    private val binding get() = _binding!!

    @SuppressLint("ResourceAsColor")
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        Log.d("TAG", "onPause: fragment创建")
        notificationsViewModel =
            ViewModelProvider(this).get(UserCenterViewModel::class.java)

        _binding = FragmentMeBinding.inflate(inflater, container, false)
        val root: View = binding.root

        val window: Window? = activity?.window
        if (window != null) {
            window.statusBarColor = activity?.getColor(R.color.transparent)!!
        }

        binding.addMusicList.setOnClickListener {
        }
        return root
    }

    override fun onDestroyView() {
        super.onDestroyView()
        _binding = null
        Log.d("TAG", "onPause: fragment销毁")
    }

    override fun onPause() {
        super.onPause()
        Log.d("TAG", "onPause: fragment暂停")
    }
}